package com.bdqn.bookshop.controller.admin;

import com.bdqn.bookshop.entity.Classify;
import com.bdqn.bookshop.service.ClassifyService;
import com.bdqn.bookshop.utils.DataGridViewResult;
import com.bdqn.bookshop.utils.Result;
import com.bdqn.bookshop.vo.ClassifyVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : 罗若然[LUO_RUO_RAN]
 * @date : 2020-07-26 16:03
 **/
@RestController
@RequestMapping("/admin/classify")
public class AdminClassifyController {

    @Autowired
    private ClassifyService classifyService;

    @RequestMapping("/list")
    public DataGridViewResult list(ClassifyVo classifyVo){
        return classifyService.getClassify(classifyVo);
    }

    @RequestMapping("/addClassify")
    public Result addClassify(Classify classify){
        return classifyService.addClassify(classify);
    }

    @RequestMapping("/updateClassify")
    public Result updateClassify(Classify classify){
        return classifyService.updateClassify(classify);
    }

    @RequestMapping("/deleteClassify")
    public Result deleteClassify(Integer id){
        return classifyService.deleteClassify(id);
    }

    @RequestMapping("/batchDelete")
    public Result batchDelete(String ids){
        return classifyService.batchDelete(ids);
    }

    @RequestMapping("/selectClassifyName")
    public Result selectClassifyName(Integer parentId){
        return classifyService.selectClassifyName(parentId);
    }

    @RequestMapping("/isClassifyNameCount")
    public Result isClassifyNameCount(Integer id,String classifyName){
        return classifyService.isClassifyNameCount(id,classifyName);
    }
}
